#!/bin/bash
SHELLDIR="/opt/shell/"
SER="nginx"
SER1="mysqld"
SER2="php-fpm"

#nginx
curl -o nginx-1.16_init.sh https://gitee.com/ffing/onekey/raw/master/nginx-1.16_init.sh && bash nginx-1.16_init.sh
#mysqld
curl -o mysql-5.7_init.sh https://gitee.com/ffing/onekey/raw/master/mysql-5.7_init.sh && bash mysql-5.7_init.sh
#php
curl -o php-7.2_init.sh https://gitee.com/ffing/onekey/raw/master/php-7.2_init.sh && bash php-7.2_init.sh

#####重启服务
#kill -9 $(ps -ef|grep ${SER} |gawk '$0 !~/grep/ {print $2}' |tr -s '\n' ' ') >/dev/null 2>&1
systemctl restart $SER
systemctl restart $SER1
systemctl restart $SER2


echo "————————————————————————————————"

#####服务状态
ps -ef|grep $SER|grep -vE "grep|$$" >/dev/null
if [ $? -eq 0 ];then
        echo -e "\e[42m "${SER}" 		        已经启动\e[0m"
else
		echo -e "\e[41m "${SER}" 		        启动失败\e[0m"
fi

ps -ef|grep $SER1|grep -vE "grep|$$" >/dev/null
if [ $? -eq 0 ];then
        echo -e "\e[42m "${SER1}" 		已经启动\e[0m"
else
		echo -e "\e[41m "${SER1}" 		启动失败\e[0m"
fi





ps -ef|grep $SER2|grep -vE "grep|$$" >/dev/null
if [ $? -eq 0 ];then
        echo -e "\e[42m "${SER2}" 		已经启动\e[0m"
else
		echo -e "\e[41m "${SER2}" 		启动失败\e[0m"
fi
